The invention relates to method for compression and decompression of a video data stream. The invention further relates to devices for executing the method.
Compression methods of this type are especially necessary for transporting video data over packet-oriented data networks since the bandwidth of packet-oriented data networks is tightly restricted. Standardized methods such as for example MPEG-1, MPEG-2 and H.26× have thus been developed with which video data can be compressed. The standardized methods operate with motion-compensating hybrid encoding, a combination of lossless redundancy reduction and lossy irrelevance reduction.
The greatest contribution to compression is made by what is known as motion-compensating prediction. Motion-compensating prediction uses the similarity of consecutive images by predicting the current image to be encoded from images already transmitted. Since mostly only parts of consecutive images move, an encoder breaks down the current image to be encoded into rectangular macro blocks which are mostly 8×8 or 16×16 pixels in size. For each of these macro blocks the encoder searches for matching macro blocks from the images already transmitted and calculates how they have shifted in relation to the macro blocks of the current image to be encoded. The shifts in the macro blocks are described by motion vectors which are encoded by the encoder on the basis of code tables.
Since the current image to be encoded cannot be constructed in every case by the shifts in macro blocks of images already transmitted, for example when new objects come into the image, the prediction error must also be transmitted from the encoder to the decoder. This prediction error is the result of the difference between the actual current image to be encoded and the prediction image constructed from shifts in macro blocks from previous images.
Since the prediction errors of adjacent pixels correlate in areas that cannot be predicted or cannot be well predicted, a transformation of the prediction errors is undertaken for further redundancy reduction. Depending on the compression method, various transformation methods are employed here. Typical normal methods are Discrete Wavelet Transformation (DWT) or Discrete Cosine Transformation (DCT). Discrete Cosine Transformation transforms each macro block from 8×8 pixels into a matrix of 8×8 spectral coefficients. In this case the first coefficient represents the average brightness of the block, this also being referred to as the direct component or “DC coefficient”. The remaining coefficients reflect with increasing index number the higher frequency component of the brightness distribution and are thus referred to as “alternating components” or “AC coefficients”.
To reduce the required data rate further, the spectral coefficients are quantized before further encoding. When the prediction error signal changes only slowly from pixel to pixel, most of the high-frequency coefficients are equal to zero after quantizing and thus do not have to be transmitted.
Since after transformation most spectral coefficients are zero, the spectral coefficients are grouped together during subsequent execution of the method by run length encoding and subsequently encoded with the aid of a code table with variable-length code words.